package com.qingcheng.service.impl;

import com.qingcheng.service.goods.CategoryService;
import com.qingcheng.service.goods.SkuService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by yuanxin
 * Date:2019/7/4
 * Time:14:27
 */
@Component
public class init implements InitializingBean {
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private SkuService skuService;
    @Autowired
    private SkuSearchServiceImpl skuSearchService;
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("缓存预热");
        System.out.println("加载分类");
        categoryService.saveCategoryTreeToRedis();//加载分类
        System.out.println("加载价格");
        skuService.saveAllPriceToRedis();//加载价格
        System.out.println("加载品牌和规格");
        skuSearchService.saveAllBrandAndSpecListByCategoryToRedis();//加载品牌和规格
    }
}
